{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5d698631",
   "metadata": {},
   "source": [
    "#元组(tuple)\n",
    "\n",
    "*[元组]\n",
    ">1.他是和list几乎不一样的序列数据\n",
    ">2.它与list不同的是，**不可变**（因为不可变，所以几乎没有办法）\n",
    ">3.元组的形式：（1，2，34，4）对比 元组（） 列表【】"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "34780f2f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('1001', '10002', '10003') <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "stu_id  = \"1001\",\"10002\",\"10003\"\n",
    "print(stu_id,type(stu_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6dd1204f",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'stu_id' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-1-ac639536428e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mstu_id\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcount\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"10001\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'stu_id' is not defined"
     ]
    }
   ],
   "source": [
    "stu_id.count(\"10001\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "38b1de00",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7908c81a",
   "metadata": {},
   "source": [
    "#字典\n",
    "\n",
    ">1.创建字典的三种常见的方法\n",
    ">>1.直接按照字典的格式创建 ： {keyl：valuel ，key2，valuel2 ，。。。\n",
    ">>2.dict()函数来创造字典： dict(keyl=value,key2=value2,.....)\n",
    ">>3.字典数据增加的方式：新建空字典 dict_name{} , dict_name[key1]=valuel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1cf62bb0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1. 直接按照字典的格式创建 ： {keyl:valuel,key2:baluel2,...}\n",
    "stud_info = {\n",
    "    \"stud_10001\":\"alex\"\n",
    "    \"stud_10002\":\"jake\"\n",
    "    \"stud_10003\":\"marry\"\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a47856cf",
   "metadata": {},
   "outputs": [],
   "source": [
    "#2.dict()函数来创造字典： dict(keyl=value,key2=value2,.....)\n",
    "stud_info_02 = dict(\n",
    "       stud_10001 = \"alex\",\n",
    "       stud_10002 = \"jake\")\n",
    "stud_info_02"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2e5152e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "stud_info_03 = {}\n",
    "stud_info_03[\"stud_10001\"]\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
